#include<stdio.h>
int main()
{
    int n = 0;
    scanf("%d", &n);
    if (n == 1)
        printf("2");
    else
        printf("%d\n", n * (1 + 3 * n) / 2);
    return 0;
}